/*
 * Copyright (C), 2002-2016, 苏宁易购电子商务有限公司
 * FileName: EmployeeHireInfoDaoImpl.java
 * Author:   15050536
 * Date:     2016年12月6日 下午7:24:20
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.suning.sawp.service.impl.dao.tm;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.suning.framework.dal.client.DalClient;
import com.suning.sawp.intf.dao.tm.TimeMachineDao;
import com.suning.sawp.po.tm.EmployeeCategoryInfo;
import com.suning.sawp.po.tm.EmployeeExpensiveSaleInfo;
import com.suning.sawp.po.tm.EmployeeFirstSaleInfo;
import com.suning.sawp.po.tm.EmployeeHireInfo;
import com.suning.sawp.po.tm.EmployeeMemberInfo;
import com.suning.sawp.po.tm.EmployeeTotalSaleInfo;

/**
 *
 * @author 15050536 石键平
 */
@Repository
public class TimeMachineDaoImpl implements TimeMachineDao{

	@Autowired
	private DalClient dalClient;

	private Map<String,Object> genarateParamMap(String employeeId){
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("employeeId", employeeId);
		return map;
	}
	
	@Override
	public EmployeeHireInfo findEmployeeHireByEmployeeId(String employeeId) {
		Map<String,Object> paramMap = genarateParamMap(employeeId);
		return dalClient.queryForObject("TM.findEmployeeHireByEmployeeId", paramMap, EmployeeHireInfo.class);
	}

	@Override
	public EmployeeFirstSaleInfo findEmployeeFirstSaleByEmployeeId(String employeeId) {
		Map<String,Object> paramMap = genarateParamMap(employeeId);
		return dalClient.queryForObject("TM.findEmployeeFirstSaleByEmployeeId", paramMap, EmployeeFirstSaleInfo.class);
	}

	
	@Override
	public EmployeeTotalSaleInfo findEmployeeTotalSaleByEmployeeId(String employeeId) {
		Map<String,Object> paramMap = genarateParamMap(employeeId);
		return dalClient.queryForObject("TM.findEmployeeTotalSaleByEmployeeId", paramMap, EmployeeTotalSaleInfo.class);
	}

	@Override
	public EmployeeExpensiveSaleInfo findEmployeeExpensiveByEmployeeId(String employeeId) {
		Map<String,Object> paramMap = genarateParamMap(employeeId);
		return dalClient.queryForObject("TM.findEmployeeExpensiveByEmployeeId", paramMap, EmployeeExpensiveSaleInfo.class);
	}

	
	@Override
	public EmployeeCategoryInfo findEmployeeCategoryByEmployeeId(String employeeId) {
		Map<String,Object> paramMap = genarateParamMap(employeeId);
		return dalClient.queryForObject("TM.findEmployeeCategoryByEmployeeId", paramMap, EmployeeCategoryInfo.class);
	}

	@Override
	public List<EmployeeMemberInfo> queryEmployeeMembersByEmployeeId(String employeeId) {
		Map<String,Object> paramMap = genarateParamMap(employeeId);
		return dalClient.queryForList("TM.queryEmployeeMembersByEmployeeId", paramMap, EmployeeMemberInfo.class);
	}
	
	@Override
	public Map<String,Object> findReceiveCouponByEmployeeId(String employeeId) {
		Map<String,Object> paramMap = genarateParamMap(employeeId);
		return dalClient.queryForMap("TM.findReceiveCouponByEmployeeId", paramMap);
	}

	@Override
	public void saveReceiveCoupon(Map<String, Object> params) {
		dalClient.execute("TM.saveReceiveCoupon", params);
	}
	
}
